home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{FFACF7F3-B868-11CE-84A8-08005A9B23BD}#1.7#0"; "DSSOCK32.OCX"
- Begin VB.Form Form1
- BorderStyle = 3 'Fixed Dialog
- Caption = "Port Blocker Example"
- ClientHeight = 1965
- ClientLeft = 1140
- ClientTop = 1515
- ClientWidth = 3510
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 1965
- ScaleWidth = 3510
- ShowInTaskbar = 0 'False
- Begin VB.CommandButton Command2
- Caption = "stop"
- Enabled = 0 'False
- Height = 195
- Left = 2520
- TabIndex = 7
- Top = 120
- Width = 735
- End
- Begin VB.CommandButton Command1
- Caption = "start"
- Height = 195
- Left = 1680
- TabIndex = 6
- Top = 120
- Width = 735
- End
- Begin VB.TextBox Text1
- Height = 855
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 5
- Top = 1080
- Width = 3495
- End
- Begin VB.TextBox Text2
- Height = 285
- Left = 1320
- TabIndex = 3
- Text = "sorry kids, this port is blocked"
- Top = 480
- Width = 2175
- End
- Begin VB.TextBox Text3
- Height = 285
- Left = 720
- TabIndex = 1
- Text = "31337"
- Top = 0
- Width = 735
- End
- Begin dsSocketLib.dsSocket dsSocket2
- Height = 420
- Left = 3120
- TabIndex = 9
- Top = 840
- Width = 420
- _Version = 65543
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 64
- LocalPort = 0
- RemoteHost = ""
- RemotePort = 0
- ServiceName = ""
- RemoteDotAddr = ""
- Linger = -1 'True
- Timeout = 10
- LineMode = 0 'False
- EOLChar = 10
- BindConnect = 0 'False
- SocketType = 0
- End
- Begin dsSocketLib.dsSocket dsSocket1
- Height = 420
- Left = 2640
- TabIndex = 8
- Top = 840
- Width = 420
- _Version = 65543
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 64
- LocalPort = 0
- RemoteHost = ""
- RemotePort = 0
- ServiceName = ""
- RemoteDotAddr = ""
- Linger = -1 'True
- Timeout = 10
- LineMode = 0 'False
- EOLChar = 10
- BindConnect = 0 'False
- SocketType = 0
- End
- Begin VB.Label Label3
- BackStyle = 0 'Transparent
- Caption = "Status:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 840
- Width = 735
- End
- Begin VB.Label Label2
- BackStyle = 0 'Transparent
- Caption = "Comment:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 480
- Width = 1095
- End
- Begin VB.Label Label1
- BackStyle = 0 'Transparent
- Caption = "Port:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 0
- Width = 495
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- On Error Resume Next
- ' --- start listening for connections --- '
- Command2.Enabled = True ' enabled the stop button
- Command1.Enabled = False ' disable the start button
- dsSocket1.LocalPort = Text3 ' set the port
- dsSocket1.Listen ' listen for connection
- End Sub
- Private Sub Command2_Click()
- On Error Resume Next
- ' --- stop listening for connections --- '
- Command1.Enabled = True ' enabled the start button
- Command2.Enabled = False ' disable the stop button
- dsSocket1.Close ' close socket
- dsSocket2.Close ' close socket
- End Sub
- Private Sub dsSocket1_Accept(SocketID As Integer)
- On Error Resume Next
- dsSocket2.Socket = SocketID ' set the socket
- dsSocket1.Close ' close the socket that was
- ' listening
- If Len(Text2) > 0 Then dsSocket2.Send = Text2
- ' if there was a message to send to the person
- ' trying to connect, send it. if not, dont send
- dsSocket2.Close ' close other socket
- Command2.Enabled = False ' disable the stop button
- Command1.Enabled = True ' enabled the start button
- End Sub
- Private Sub dssocket2_Connect()
- ' this control is only used to send the comment
- ' to the person trying to connect. other then that
- ' it isn't used. i bet it feels left out ;[
- ' hehe....
- End Sub
- Private Sub Form_Load()
- On Error Resume Next
- dsSocket1.Close
- dsSocket2.Close
- ' i just do this to make sure the socket is closed
- ' its not really needed, but what the hell... hehe
- End Sub
- Private Sub Form_Terminate()
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- On Error Resume Next
- dsSocket1.Close ' close sockets so you wont error
- ' the next time you run the program
- dsSocket2.Close ' close sockets
- ' the next time you run the program
- End Sub
-